home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / SCSI Samples 1.0 / SCSI Async Sample 06⁄15 ƒ / Src / GetSCSICDBLength.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-16  |  745 b   |  31 lines  |  [TEXT/KAHL]

  1. /*                                GetSCSICDBLength.c                                */
  2. /*
  3.  * GetSCSICDBLength.c
  4.  * Copyright © 1992-93 Apple Computer Inc. All Rights Reserved.
  5.  */
  6. #include    "SCSIAsyncSample.h"
  7.  
  8. /*
  9.  * Look at the "group code" in the command operation. Return zero (error) for
  10.  * the reserved (3, 4) and vendor-specific command (6, 7) command groups.
  11.  * Otherwise, return the command length from the group code value as specified
  12.  * in the SCSI-II spec.
  13.  */
  14. short
  15. GetSCSICDBLength(
  16.         const SCSI_CommandPtr    scsiCommandPtr
  17.     )
  18. {
  19.         short                    result;
  20.         
  21.         switch (scsiCommandPtr->scsi[0] & 0xE0) {
  22.         case (0 << 5):    result = 6;        break;
  23.         case (1 << 5):
  24.         case (2 << 5):    result = 10;    break;
  25.         case (5 << 5):    result = 12;    break;
  26.         default:        result = 0;        break;
  27.         }
  28.         return (result);
  29. }
  30.  
  31.